from django.db import models
# Create your models here.

class AdminUsers(models.Model):
    """
    后台用户表
    """
    id = models.BigAutoField(primary_key=True)
    username = models.CharField(verbose_name="用户名", max_length=32, blank=False, null=False)
    password = models.CharField(verbose_name="密码", max_length=64, blank=False, null=False)
    salt = models.CharField(verbose_name="密码盐", max_length=24, blank=False, null=False)
    status = models.BooleanField(verbose_name="当前状态", default=True)
    last_login_at = models.DateTimeField(verbose_name="最后登录时间", null=True, blank=True, default=None)
    last_login_ip = models.GenericIPAddressField(verbose_name="最后登陆ip", null=True, blank=True, default='')
    created_at = models.DateTimeField(auto_now_add=True)
    updated_at = models.DateTimeField(auto_now=True)

    def __str__(self):
        return self.username
